<?php
	echo '<?php
$form_name="'.$arOut['form_name'].'"."_";
if( isset($_REQUEST[ $form_name."posted"]) ){'.
	'if(count(Page::$messages["error"])<1){
		try{
			/* code... */
			Page::message( "success", null, Lang::get("OPERATION_IS_EXECUTED").": ".$operation );
		}catch(Exception $e){
			Page::message( "error", null, Lang::get("ERROR_OF_EXECUTION").": ".$operation );
		}	
	}
	foreach( $_REQUEST as $name=>$value) Form::value( $form_name.$name, $value);'.
'}
?>'.PHP_EOL.
'<?php echo Page::outMessages(); echo Form::outErrors( '.$arOut['form_name'].' );?>'.PHP_EOL.
'<form  method="post" name="<?php echo $form_name?>" action="">'.PHP_EOL.
'<input type="hidden" name="<?php echo $form_name?>posted" value="1"/>'.PHP_EOL;
?>
	<table class="form_table">
	<tbody>
<?php
foreach($arOut['inputs'] as $input){
	$_name_id = 'name="'.$input['name'].'" id="'.$input['name'].'"';
	$_value = '<?php echo Form::value( $form_name."'.$input['name'].'");?>';
	
	switch ( $input['data_type'] ){	
		case 'text':
			$_input = '<textarea '.$_name_id.' >'.$_value.'</textarea>';
			break;
		case 'enum':
		case 'set':
			$_input = '<select '.$_name_id.' value="'.$_value.'" >'.
			'<option value=""></option>'.
			'</select>';
			break;
		case 'int':
		case 'varchar':
		default:
			$_input = '<input type="text" '.$_name_id.' value="'.$_value.'" >';
			break;				
	}
	
	echo '<tr>'."\n".
		'	<td width="250">'.
				$input['title'].
				( $input['is_nullable']=='NO'? '<b style="color:red">*</b>' : '' ).
			'</td>'."\n".
		'	<td>'."\n".
		'		'.$_input."\n".
		'	</td>'."\n".
		'</tr>'."\n";
}
?>
	</tbody>	
	</table>
	<input type="submit" name="submit" value="Save"/>
</form>